package com.softeem.work.w4;

public class Worker extends Emp{
    public Worker() {
    }

    public Worker(int id, String name, double salary) {
        super(id, name, salary);
    }

    @Override
    public void work(Object obj) {
        Worker worker = null;
        //instanceof:判断
        //判断前面的obj对象是不是Worker类型
        //最终的结果是一个boolean类型
        if(obj instanceof Worker){
            //如果是,就将其进行强制类型转换
             worker = (Worker) obj;
        }
        System.out.println("id:"+worker.getId());
        System.out.println("worker:"+worker.getName());
        System.out.println("salary:"+worker.getSalary());
    }
}
